<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户中心页面</title>
</head>
<body>
<form action="#" method="post" enctype="multipart/form-data">
    <p><h3>头像预览</h3></p>
<?php
$user=$_POST['user'];
$pwd=$_POST['password'];
if ($user=='admin' && $pwd=='888888'){
    $Md5Cookies=($user.$pwd.time());
    echo '登录成功';
    setcookie('Token',$Md5Cookies,time()+24*3600);
    echo '<br> <h3>用户中心</h3>';
    if (isset($_COOKIE['Token'])){
        echo 'cookies存在！！！';
    }else{
        echo 'cookies不存在！！！';
    }
}else{
    echo '登录失败';
}
?>
    <p>请选择预览的图片：
        <input type="file" name="file" id="file" multiple onchange="showImg()">
    </p>
    <p>
        <img src="" id="imgID">
    </p>
</form>
</body>
<script>
    function showImg(){
        var imgid=document.getElementById('imgID');
        imgid.style.border='10px greenyellow solid';
        imgid.style.width='100px';
        imgid.style.height='100px';
        var objimg=document.getElementById('file');
        var Url=window.URL || window.webkitURL;
        var imgUrl=Url.createObjectURL(objimg.files[0]);
        document.getElementById('imgID').src=imgUrl;
    }
</script>
</html>








